home *** CD-ROM | disk | FTP | other *** search
/ Aminet 21 / Aminet 21 (1997)(GTI - Schatztruhe)[!][Oct 1997].iso / Aminet / comm / mail / YAMscripts.lha / DeleteOld.rexx < prev    next >
OS/2 REXX Batch file  |  1997-05-25  |  1KB  |  46 lines

  1. /*                            DeleteOld.rexx
  2.                  v1.0 - 22-Nov-96
  3.  
  4. This script will mark all messages older than limit days as deleted.  It doesn't
  5. automatically remove them, unless variable auto_rem is set to 'YES'.  The date
  6. of a message is read from the file, not from message headers.
  7.  
  8. Send suggestions and bug reports to knikulai@utu.fi
  9.  
  10. Check http://www.utu.fi/~knikulai/ARexx.html for other scripts!
  11. */
  12.  
  13. options results
  14. limit=30    /* All messages older than limit days, will be deleted */
  15. ask_conf='YES'  /* If set to YES, a requester is displayed first */
  16. auto_rem='NO'   /* If this variable is set to YES, messages are not just marked
  17.                    as deleted, they are really removed from the disk.  There is
  18.            no way you can undelete them from YAM, so be careful! */
  19. call addlib('rexxsupport.library', 0, -30, 0)
  20. today=date(I)
  21.  
  22. address 'YAM'
  23. if ask_conf=='YES' then do
  24.    foo=date(N,today-limit,I)
  25.    'Request "Are you sure you want to delete messages*nreceived before P[2]'||foo||'P[1]?" "_Yes|_No"'
  26.    if result=0 then exit
  27. end
  28. 'GetFolderInfo Max'
  29. n=result
  30.  
  31. do msg=0 to n-1
  32.     'SetMail' msg
  33.     'GetMailInfo File'
  34.     fname=result
  35.     fi=statef(fname)
  36.     parse var fi ft bytes blocks flags days .
  37.     if limit<today-days then do
  38.         if auto_rem=='YES' then
  39.         call delete(fname)
  40.     else
  41.         'MailDelete'
  42.     end /* if limit<today-days then */
  43. end /*do msg=0 to n-1*/
  44. if auto_rem=='YES' then address 'YAM' 'MailUpdate'
  45. exit
  46.